package org.nepu.scr.indexrate.converter.compliancerate.keyperformanceindicator.nozzleandtubingtestpressureparametertable;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.compliancerate.keyperformanceindicator.nozzleandtubingtestpressureparametertable.MenuBar;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class MenuBarConverter implements AttributeConverter<MenuBar, String> {
    @Override
    public String convertToDatabaseColumn(MenuBar menuBar) {
        return JSONUtil.toJsonStr(menuBar);
    }

    @Override
    public MenuBar convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, MenuBar.class);
    }
}
